//
// Created by xunx on 2018/12/8.
//

#ifndef GOWILD_RESOURCE_H
#define GOWILD_RESOURCE_H

#include "Gowild.h"

class Sprite;

class Shader;

class Texture2D;

class Vertices;


class Resource {
public:

    static Sprite* CreateSprite(std::string name, float w, float h, float x, float y, float r, Texture2D texture);

    static Sprite* GetSprite(std::string name);

    static bool DeleteSprite(std::string name);

    static void LoadShader(std::string shaderName);

    static Shader GetShader(std::string shaderName);

    static void LoadTexture2D(const char* file, bool alpha, std::string Texture2DName);

    static Texture2D GetTexture2D(std::string Texture2DName);

    static Vertices GetVertices(std::string VerticesName);

    static void InitResource();

    static std::unordered_map<std::string, Sprite*> GetSpriteResource();

private:

    static std::unordered_map<std::string, Shader> ShaderResource;
    static std::unordered_map<std::string, Texture2D> Texture2DResource;
    static std::unordered_map<std::string, Vertices> VerticesResource;
    static std::unordered_map<std::string, Sprite*> SpriteResource;

    static Shader LoadShaderForFile();

    static Texture2D LoadTexture2DForFile(const char* file, bool alpha);

};


#endif //GOWILD_RESOURCE_H
